package c.i.b.b.b;

import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import java.util.ArrayList;
import java.util.List;

public final class b implements SensorEventListener {
    public static b f;
    public SensorManager a = null;
    public int b;
    public int c = 0;
    public float[] d = new float[3];
    public List<String> e = new ArrayList();

    public b(Context context) {
        context = context.getApplicationContext();
        if (context != null) {
            try {
                this.a = (SensorManager) context.getSystemService("sensor");
            } catch (Throwable unused) {
            }
        }
    }

    public static b a(Context context) {
        if (f == null) {
            synchronized (b.class) {
                if (f == null) {
                    f = new b(context);
                }
            }
        }
        return f;
    }

    public final synchronized void b() {
        try {
            SensorManager sensorManager = this.a;
            if (sensorManager != null) {
                int i = this.b - 1;
                this.b = i;
                if (i == 0) {
                    sensorManager.unregisterListener(this);
                }
            }
        } catch (Exception unused) {
        }
    }

    public void onAccuracyChanged(Sensor sensor, int i) {
    }

    public void onSensorChanged(SensorEvent sensorEvent) {
        this.d = sensorEvent.values;
        this.c = 1;
    }
}
